#ifndef _ROTATIONCONVERSION_
#define _ROTATIONCONVERSION_

#include "Quaternion.h"

#ifndef M_PI
#define M_PI 3.141592653589793
#endif

class Rotation{
public:
	enum RotationOrder {XYZ, XZY, YZX, YXZ, ZXY, ZYX};
	static Quaternion MatrixToQuat(const Mat3d &_mat);	// forms the Quaternion from a rotation matrix
	static Quaternion MatrixToQuat(const Mat4d &_mat);	// forms the Quaternion from a rotation matrix
	static Quaternion ExpToQuat(Vec3d v);
	static Vec3d QuatToExp(Quaternion q);
	static Mat3d QuatToMatrix(Quaternion q);

	// Note: xyz order means matrix is Rz*Ry*Rx i.e a point as transformed as Rz*Ry*Rx(p)
	// coord sys transformation as in GL will be written as glRotate(z); glRotate(y); glRotate(x)
	static Vec3d MatrixToEuler(Mat3d m, RotationOrder _order);
	static Mat3d EulerToMatrix(Vec3d v, RotationOrder _order);

	static Mat3d EulerToMatrixX(double x);
	static Mat3d EulerToMatrixY(double y);
	static Mat3d EulerToMatrixZ(double z);
};

#endif